from django.db import models
from django.contrib import admin

# user personal data
class User(models.Model):
    name = models.CharField(max_length = "127")
    birthday = models.DateField()
    
class Anthropometry(models.Model):
    date = models.DateField()               # date when anthropometrics values was added (measured) 
    #user = models.ForeignKey(User, related_name = "anthropometrics")          # to which user is related
    weight = models.FloatField()            # user weight in kilograms and grams (for example "73.21")
    height = models.IntegerField()          # user height in centimeters (for example "182" cm)
    neckGirth = models.FloatField()         # user neck girth in centimeters
    chestGirth = models.FloatField()        # user chest girth
    bicepsGirth = models.FloatField()       # biceps girth
    forearmGirth = models.FloatField()      # forearm (midarm) girth
    wristGirth = models.FloatField()        # wrist girth
    waistGirth = models.FloatField()        # waistline girth
    coxalGirth = models.FloatField()        # coxal girth
    hipGirth = models.FloatField()          # hip girth
    shinGirth = models.FloatField()         # shin girth
    ankleGirth = models.FloatField()        # ankle girth
    
class Biometry(models.Model):
    date = models.DateField()               # date when biometrics values was added
    #user = models.ForeignKey(User, related_name = "biometrics")          # to which user is related
    BMI = models.FloatField()               # user body mass index
    bodyFat = models.FloatField()           # body fat percentage
    bodyWater = models.FloatField()         # body water percentage
    bodyMuscle = models.FloatField()        # body muscle percentage
    bodyBoneWeight = models.FloatField()    # weight of bones


# admin block
class UserAdmin(admin.ModelAdmin):
    list_display = ('name', 'birthday',)

admin.site.register(User, UserAdmin)
    
class Exercise(models.Model):
    title = models.CharField(max_length = "127")
    description = models.TextField()

# training and exercise program related data
class Program(models.Model):
    title = models.CharField(max_length = "127")
    exercises = models.ManyToManyField(Exercise, through="ProgramExercises")
    
class ProgramExercises(models.Model):
    reps = models.IntegerField()            # counts of repetitions of specific exercise depending to the programm
    sets = models.IntegerField()            # counts of sets
    program = models.ForeignKey(Program)
    exercise = models.ForeignKey(Exercise)

#admin block
class ExerciseAdmin(admin.ModelAdmin):
    list_display = ('title',)
    
class ProgramAdmin(admin.ModelAdmin):
    list_display = ("title",)
    
admin.site.register(Exercise, ExerciseAdmin)
admin.site.register(Program, ProgramAdmin)